<html lang="zh-CN">
  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/themes/admin/assets/css/layui.css">
    <link rel="icon" href="/favicon.ico">
    <title>管理后台</title>
  </head>
  <body style="background:#FFF">
    <blockquote class="layui-elem-quote layui-quote-nm">
      <h3>置顶推荐下方广告位</h3>(点击图片更换)
      <hr />
      <img id="adImge1" style="width:100%;height:200px;cursor: pointer;" src="/uploads/ad/ad1.png" />
    </blockquote>
    <blockquote class="layui-elem-quote layui-quote-nm">
      <h3>首页右侧广告位</h3>（点击图片更换)
      <hr />
      <img id="adImge2" style="width:400px;height：400px;cursor: pointer;" src="/uploads/ad/ad2.png" />
    </blockquote>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script src="/themes/admin/assets/layui.js"></script>
    <script>
      layui.use("layer");
      //ad1更换
      layui.use("upload",function(){
        var upload = layui.upload;
        upload.render({
          elem: '#adImge1'
          ,field:'image'
          ,url: '/addons/execute/advertising-admin-upload.html'
          ,data:{"type":"ad1"}    
           ,done:function(res){
            if(res.code == 200){
             $("#adImge1").attr("src",res.path);
              layer.msg(res.msg);
            }else{
             layer.msg(res.msg);
            }
          }
        });
      });
      //ad2更换
      layui.use("upload",function(){
        var upload = layui.upload;
        upload.render({
          elem: '#adImge2'
          ,field:'image'
          ,url: '/addons/execute/advertising-admin-upload.html'
          ,data:{"type":"ad2"}
          ,done:function(res){
            if(res.code == 200){
             $("#adImge2").attr("src",res.path);
              layer.msg(res.msg);
            }else{
             layer.msg(res.msg);
            }
          }
        });
      });
    </script>
  </body>
</html>